// The MIT License (MIT)

// Copyright (c) 2020 by German A. Arias

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in 
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

//#include <eiffel-iup.h>

#include "eif_setup.h"
#include "eif_eiffel.h"

// IUP
#include <stdlib.h>
#include <iup/iup.h>
#include <iup/iupkey.h>
#include <iup/iup_config.h>
#include <iup/iupcontrols.h>

// For IM
#include <im/im.h>
#include <im/im_image.h>
#include <iup/iupim.h>

// For CD
#include <cd/cd.h>
#include <cd/wd.h>
#include <cd/cdiup.h>
#include <cd/cdim.h>

EIF_OBJECT obj = NULL; 

EIF_PROC help_cb_Fn,
// Common callback      
  idle_action_Fidle,
// Common callbacks     
  map_cb_Fn,
  unmap_cb_Fn,
  destroy_cb_Fn,
  ldestroy_cb_Fn,
  getfocus_cb_Fn,
  killfocus_cb_Fn,
  enterwindow_cb_Fn,
  leavewindow_cb_Fn,
  action_Fn,            
// Common callback      
  k_any_Fni,
// Dialog and progress d
  close_cb_Fn,
  copydata_cb_Fnsi,
  dropfiles_cb_Fnsiii,
  mdiactivate_cb_Fn,
  move_cb_Fnii,
  resize_cb_Fnii,
  show_cb_Fni,      
  trayclick_cb_Fniii,
// File dialog callback 
  file_cb_Fnss,
// Color dialog callback
  colorupdate_cb_Fn,
// Progress dialog callb
  cancel_cb_Fn,
// Tabs callback        
  tabchange_cb_Fnnn,
  tabchangepos_cb_Fnii,
  tabclose_cb_Fni,
  rightclick_cb_Fni,
// DetachedBox callback 
  detached_cb_Fnnii,
  restored_cb_Fnnii,
// Expander callback    
  openclose_cb_Fni,
  extrabutton_cb_Fnii,
// Split callback       
  valuechanged_cb_Fn,
// Button callback      
  button_cb_Fniiiis,
// Canvas callback      
  action_Fnff,
  focus_cb_Fni,
  motion_cb_Fniis,
  keypress_cb_Fnii,
  scroll_cb_Fniff,
  wheel_cb_Fndiis,
// Link callback        
  click_cb_Fns,
// List callbacks       
  action_Fnsii,
  caret_cb_Fniii,
  dblclick_cb_Fnis,
  dragdrop_cb_Fniiii,
  dropdown_cb_Fni,
  edit_cb_Fnis,      
  multiselect_cb_Fns,
// Spin callback        
  spin_cb_Fni,
// Callback for text    
  action_Fnis,          
// Callback for toggle  
  action_Fni,           
// Callbacks for tree   
  selection_cb_Fnii,       
  multiselection_cb_Fnpi,  
  multiunselection_cb_Fnpi,
  branchopen_cb_Fni,
  branchclose_cb_Fni,
  executeleaf_cb_Fni,
  showrename_cb_Fni,
  rename_cb_Fnis,
  noderemoved_cb_Fns,
  togglevalue_cb_Fnii,
// Callbacks for menu
  highlight_cb_Fn,
  open_cb_Fn,
  menuclose_cb_Fn,
// Drag & Drop callbacks 
  dragbegin_cb_Fnii,
  dragdatasize_cb_Fns,
  dragdata_cb_FnsVi,
  dragend_cb_Fni,
  dropdata_cb_FnsViii,
  dropmotion_cb_Fniis,
// Menu recent files    
  recent_cb_Fn,
// Get Param            
  param_cb_FniV,
// Flat button         
  flat_action_Fn,
  flat_button_cb_Fniiiis,
  flat_focus_cb_Fni,
  flat_enterwindow_cb_Fn,
  flat_leavewindow_cb_Fn,
// Cells                
  draw_cb_Fniiiiiic,
  height_cb_Fni,
  hspan_cb_Fnii,
  mouseclick_cb_Fniiiiiis,
  mousemotion_cb_Fniiiis,
  ncols_cb_Fn,
  nlines_cb_Fn,
  scrolling_cb_Fnii,
  vspan_cb_Fnii,
  width_cb_Fni,
// Color bar            
  cell_cb_Fni,
  extended_cb_Fni,
  select_cb_Fnii,
  switch_cb_Fnii,
// Matrix               
  action_Fniiiis,
  click_cb_Fniis,
  colresize_cb_Fni,
  release_cb_Fniis,
  resizematrix_cb_Fnii,
  mousemove_cb_Fnii,
  enteritem_cb_Fnii,
  leaveitem_cb_Fnii,
  scrolltop_cb_Fnii,
  bgcolor_cb_FniiVVV,
  fgcolor_cb_FniiVVV,
//  font_cb_Fnii,            
//  type_cb_Fnii,            
  dropcheck_cb_Fnii,
//  translatevalue_cb_Fniis, 
  togglevalue_cb_Fniii,
  drop_cb_Fnnii,
  menudrop_cb_Fnnii,
  dropselect_cb_Fniinsii,
  edition_cb_Fniiii,
//  value_cb_Fnii,           
  value_edit_cb_Fniis,
  mark_cb_Fnii,
  markedit_cb_Fniii,
// Flat tabs            
  flat_motion_cb_Fniis,
// Drop button          
  flat_dropshow_cb_Fni,
// Dial                 
  button_press_cb_Fnd,
  button_release_cb_Fnd,
  mousemove_cb_Fnd,
// Color browser        
  change_cb_FnVVV,
  drag_cb_FnVVV,
  font_cb_Fnii,
  type_cb_Fnii,
  translatevalue_cb_Fniis,
  value_cb_Fnii;

// Convert const char* to char*
char* unconst_char (const char* s) {
  int i;
  char* res;

  if (s != NULL) {
    for (i = 0; s[i] != '\0'; i++) {
      res[i] = s[i];
    }

    res[i] = '\0';
  }

  return res;
}

void set_callbacks (EIF_REFERENCE iup_obj,
         EIF_PROC launch_help_cb_fn, EIF_PROC launch_idle_action_fidle, EIF_PROC launch_map_cb_fn,
	 EIF_PROC launch_unmap_cb_fn, EIF_PROC launch_destroy_cb_fn, EIF_PROC launch_ldestroy_cb_fn,
	 EIF_PROC launch_getfocus_cb_fn, EIF_PROC launch_killfocus_cb_fn, EIF_PROC launch_enterwindow_cb_fn,
	 EIF_PROC launch_leavewindow_cb_fn, EIF_PROC launch_action_fn, EIF_PROC launch_k_any_fni,
	 EIF_PROC launch_close_cb_fn, EIF_PROC launch_copydata_cb_fnsi, EIF_PROC launch_dropfiles_cb_fnsiii,
         EIF_PROC launch_mdiactivate_cb_fn, EIF_PROC launch_move_cb_fnii, EIF_PROC launch_resize_cb_fnii,
	 EIF_PROC launch_show_cb_fni, EIF_PROC launch_trayclick_cb_fniii, EIF_PROC launch_file_cb_fnss,
	 EIF_PROC launch_colorupdate_cb_fn, EIF_PROC launch_cancel_cb_fn, EIF_PROC launch_tabchange_cb_fnnn,
	 EIF_PROC launch_tabchangepos_cb_fnii, EIF_PROC launch_tabclose_cb_fni, EIF_PROC launch_rightclick_cb_fni,
	 EIF_PROC launch_detached_cb_fnnii, EIF_PROC launch_restored_cb_fnnii, EIF_PROC launch_openclose_cb_fni,
	 EIF_PROC launch_extrabutton_cb_fnii, EIF_PROC launch_valuechanged_cb_fn, EIF_PROC launch_button_cb_fniiiis,
	 EIF_PROC launch_action_fnff, EIF_PROC launch_focus_cb_fni, EIF_PROC launch_motion_cb_fniis, EIF_PROC launch_keypress_cb_fnii,
	 EIF_PROC launch_scroll_cb_fniff, EIF_PROC launch_wheel_cb_fndiis, EIF_PROC launch_click_cb_fns,
	 EIF_PROC launch_action_fnsii, EIF_PROC launch_caret_cb_fniii, EIF_PROC launch_dblclick_cb_fnis,
	 EIF_PROC launch_dragdrop_cb_fniiii, EIF_PROC launch_dropdown_cb_fni, EIF_PROC launch_edit_cb_fnis,
	 EIF_PROC launch_multiselect_cb_fns, EIF_PROC launch_spin_cb_fni, EIF_PROC launch_action_fnis,
	 EIF_PROC launch_action_fni, EIF_PROC launch_selection_cb_fnii, EIF_PROC launch_multiselection_cb_fnpi,
	 EIF_PROC launch_multiunselection_cb_fnpi, EIF_PROC launch_branchopen_cb_fni, EIF_PROC launch_branchclose_cb_fni,
	 EIF_PROC launch_executeleaf_cb_fni, EIF_PROC launch_showrename_cb_fni, EIF_PROC launch_rename_cb_fnis,
	 EIF_PROC launch_noderemoved_cb_fns, EIF_PROC launch_togglevalue_cb_fnii, EIF_PROC launch_highlight_cb_fn,
	 EIF_PROC launch_open_cb_fn, EIF_PROC launch_menuclose_cb_fn, EIF_PROC launch_dragbegin_cb_fnii,
	 EIF_PROC launch_dragdatasize_cb_fns, EIF_PROC launch_dragdata_cb_fnsvi, EIF_PROC launch_dragend_cb_fni,
	 EIF_PROC launch_dropdata_cb_fnsviii, EIF_PROC launch_dropmotion_cb_fniis, EIF_PROC launch_recent_cb_fn,
	 EIF_PROC launch_param_cb_fniv, EIF_PROC launch_flat_action_fn, EIF_PROC launch_flat_button_cb_fniiiis,
	 EIF_PROC launch_flat_focus_cb_fni, EIF_PROC launch_flat_enterwindow_cb_fn, EIF_PROC launch_flat_leavewindow_cb_fn,
	 EIF_PROC launch_draw_cb_fniiiiiic, EIF_PROC launch_height_cb_fni, EIF_PROC launch_hspan_cb_fnii,
	 EIF_PROC launch_mouseclick_cb_fniiiiiis, EIF_PROC launch_mousemotion_cb_fniiiis, EIF_PROC launch_ncols_cb_fn,
	 EIF_PROC launch_nlines_cb_fn, EIF_PROC launch_scrolling_cb_fnii, EIF_PROC launch_vspan_cb_fnii,
	 EIF_PROC launch_width_cb_fni, EIF_PROC launch_cell_fni, EIF_PROC launch_extended_fni,
	 EIF_PROC launch_select_fnii, EIF_PROC launch_switch_fnii, EIF_PROC launch_action_fniiiis,
	 EIF_PROC launch_click_fniis, EIF_PROC launch_colresize_fni, EIF_PROC launch_release_fniis,
	 EIF_PROC launch_resizematrix_fnii, EIF_PROC launch_mousemove_fnii, EIF_PROC launch_enteritem_fnii,
	 EIF_PROC launch_leaveitem_fnii, EIF_PROC launch_scrolltop_fnii, EIF_PROC launch_bgcolor_fniivvv,
	 EIF_PROC launch_fgcolor_fniivvv, EIF_PROC launch_font_fnii, EIF_PROC launch_type_fnii,
	 EIF_PROC launch_dropcheck_fnii, EIF_PROC launch_translatevalue_fniis, EIF_PROC launch_togglevalue_fniii,
	 EIF_PROC launch_drop_fnnii, EIF_PROC launch_menudrop_fnnii, EIF_PROC launch_dropselect_fniinsii,
	 EIF_PROC launch_edition_fniiii, EIF_PROC launch_value_fnii, EIF_PROC launch_value_edit_fniis,
	 EIF_PROC launch_mark_fnii, EIF_PROC launch_markedit_fniii, EIF_PROC launch_flat_motion_cb_fniis,
	 EIF_PROC launch_dropshow_cb_fni, EIF_PROC launch_button_press_cb_fnd, EIF_PROC launch_button_release_cb_fnd,
	 EIF_PROC launch_mousemove_cb_fnd, EIF_PROC launch_change_cb_fnvvv, EIF_PROC launch_drag_cb_fnvvv)
{
  if (obj != NULL) 
    { eif_wean (obj); }

  obj = eif_protect (iup_obj);
  
//Commoncallback
  help_cb_Fn = launch_help_cb_fn;

//Commoncallback
  idle_action_Fidle = launch_idle_action_fidle;

//Commoncallbacks
  map_cb_Fn = launch_map_cb_fn;
  unmap_cb_Fn = launch_unmap_cb_fn;
  destroy_cb_Fn = launch_destroy_cb_fn;
  ldestroy_cb_Fn = launch_ldestroy_cb_fn;
  getfocus_cb_Fn = launch_getfocus_cb_fn;
  killfocus_cb_Fn = launch_killfocus_cb_fn;
  enterwindow_cb_Fn = launch_enterwindow_cb_fn;
  leavewindow_cb_Fn = launch_leavewindow_cb_fn;
  action_Fn = launch_action_fn;

//Commoncallback
  k_any_Fni = launch_k_any_fni;

//Dialogandprogressdialogcallback
  close_cb_Fn = launch_close_cb_fn;
  copydata_cb_Fnsi = launch_copydata_cb_fnsi;
  dropfiles_cb_Fnsiii = launch_dropfiles_cb_fnsiii;
  mdiactivate_cb_Fn = launch_mdiactivate_cb_fn;
  move_cb_Fnii = launch_move_cb_fnii;
  resize_cb_Fnii = launch_resize_cb_fnii;
  show_cb_Fni = launch_show_cb_fni;
  trayclick_cb_Fniii = launch_trayclick_cb_fniii;

//Filedialogcallback
  file_cb_Fnss = launch_file_cb_fnss;

//Colordialogcallback
  colorupdate_cb_Fn = launch_colorupdate_cb_fn;

//Progressdialogcallback
  cancel_cb_Fn = launch_cancel_cb_fn;

//Tabscallback
  tabchange_cb_Fnnn = launch_tabchange_cb_fnnn;
  tabchangepos_cb_Fnii = launch_tabchangepos_cb_fnii;
  tabclose_cb_Fni = launch_tabclose_cb_fni;
  rightclick_cb_Fni = launch_rightclick_cb_fni;

//DetachedBoxcallback
  detached_cb_Fnnii = launch_detached_cb_fnnii;
  restored_cb_Fnnii = launch_restored_cb_fnnii;

//Expandercallback
  openclose_cb_Fni = launch_openclose_cb_fni;
  extrabutton_cb_Fnii = launch_extrabutton_cb_fnii;

//Splitcallback
  valuechanged_cb_Fn = launch_valuechanged_cb_fn;

//Buttoncallback
  button_cb_Fniiiis = launch_button_cb_fniiiis;

//Canvascallback
  action_Fnff = launch_action_fnff;
  focus_cb_Fni = launch_focus_cb_fni;
  motion_cb_Fniis = launch_motion_cb_fniis;
  keypress_cb_Fnii = launch_keypress_cb_fnii;
  scroll_cb_Fniff = launch_scroll_cb_fniff;
  wheel_cb_Fndiis = launch_wheel_cb_fndiis;

//Linkcallback
  click_cb_Fns = launch_click_cb_fns;

//Listcallbacks
  action_Fnsii = launch_action_fnsii;
  caret_cb_Fniii = launch_caret_cb_fniii;
  dblclick_cb_Fnis = launch_dblclick_cb_fnis;
  dragdrop_cb_Fniiii = launch_dragdrop_cb_fniiii;
  dropdown_cb_Fni = launch_dropdown_cb_fni;
  edit_cb_Fnis = launch_edit_cb_fnis;
  multiselect_cb_Fns = launch_multiselect_cb_fns;

//Spincallback
  spin_cb_Fni = launch_spin_cb_fni;

//Callbackfortext
  action_Fnis = launch_action_fnis;

//Callbackfortoggle
  action_Fni = launch_action_fni;

//Callbacksfortree
  selection_cb_Fnii = launch_selection_cb_fnii;
  multiselection_cb_Fnpi = launch_multiselection_cb_fnpi;
  multiunselection_cb_Fnpi = launch_multiunselection_cb_fnpi;
  branchopen_cb_Fni = launch_branchopen_cb_fni;
  branchclose_cb_Fni = launch_branchclose_cb_fni;
  executeleaf_cb_Fni = launch_executeleaf_cb_fni;
  showrename_cb_Fni = launch_showrename_cb_fni;
  rename_cb_Fnis = launch_rename_cb_fnis;
  noderemoved_cb_Fns = launch_noderemoved_cb_fns;
  togglevalue_cb_Fnii = launch_togglevalue_cb_fnii;

//Callbacksformenuitem
  highlight_cb_Fn = launch_highlight_cb_fn;
  open_cb_Fn = launch_open_cb_fn;
  menuclose_cb_Fn = launch_menuclose_cb_fn;

//Drag&Dropcallbacks
  dragbegin_cb_Fnii = launch_dragbegin_cb_fnii;
  dragdatasize_cb_Fns = launch_dragdatasize_cb_fns;
  dragdata_cb_FnsVi = launch_dragdata_cb_fnsvi;
  dragend_cb_Fni = launch_dragend_cb_fni;
  dropdata_cb_FnsViii = launch_dropdata_cb_fnsviii;
  dropmotion_cb_Fniis = launch_dropmotion_cb_fniis;

//Menurecentfiles
  recent_cb_Fn = launch_recent_cb_fn;

//GetParam
  param_cb_FniV = launch_param_cb_fniv;

//Flatbutton
  flat_action_Fn = launch_flat_action_fn;
  flat_button_cb_Fniiiis = launch_flat_button_cb_fniiiis;
  flat_focus_cb_Fni = launch_flat_focus_cb_fni;
  flat_enterwindow_cb_Fn = launch_flat_enterwindow_cb_fn;
  flat_leavewindow_cb_Fn = launch_flat_leavewindow_cb_fn;

//Cells
  draw_cb_Fniiiiiic = launch_draw_cb_fniiiiiic;
  height_cb_Fni = launch_height_cb_fni;
  hspan_cb_Fnii = launch_hspan_cb_fnii;
  mouseclick_cb_Fniiiiiis = launch_mouseclick_cb_fniiiiiis;
  mousemotion_cb_Fniiiis = launch_mousemotion_cb_fniiiis;
  ncols_cb_Fn = launch_ncols_cb_fn;
  nlines_cb_Fn = launch_nlines_cb_fn;
  scrolling_cb_Fnii = launch_scrolling_cb_fnii;
  vspan_cb_Fnii = launch_vspan_cb_fnii;
  width_cb_Fni = launch_width_cb_fni;

//Colorbar
  cell_cb_Fni = launch_cell_fni;
  extended_cb_Fni = launch_extended_fni;
  select_cb_Fnii = launch_select_fnii;
  switch_cb_Fnii = launch_switch_fnii;

//Matrix
  action_Fniiiis = launch_action_fniiiis;
  click_cb_Fniis = launch_click_fniis;
  colresize_cb_Fni = launch_colresize_fni;
  release_cb_Fniis = launch_release_fniis;
  resizematrix_cb_Fnii = launch_resizematrix_fnii;
  mousemove_cb_Fnii = launch_mousemove_fnii;
  enteritem_cb_Fnii = launch_enteritem_fnii;
  leaveitem_cb_Fnii = launch_leaveitem_fnii;
  scrolltop_cb_Fnii = launch_scrolltop_fnii;
  bgcolor_cb_FniiVVV = launch_bgcolor_fniivvv;
  fgcolor_cb_FniiVVV = launch_fgcolor_fniivvv;
  font_cb_Fnii = launch_font_fnii;
  type_cb_Fnii = launch_type_fnii;
  dropcheck_cb_Fnii = launch_dropcheck_fnii;
  translatevalue_cb_Fniis = launch_translatevalue_fniis;
  togglevalue_cb_Fniii = launch_togglevalue_fniii;
  drop_cb_Fnnii = launch_drop_fnnii;
  menudrop_cb_Fnnii = launch_menudrop_fnnii;
  dropselect_cb_Fniinsii = launch_dropselect_fniinsii;
  edition_cb_Fniiii = launch_edition_fniiii;
  value_cb_Fnii = launch_value_fnii;
  value_edit_cb_Fniis = launch_value_edit_fniis;
  mark_cb_Fnii = launch_mark_fnii;
  markedit_cb_Fniii = launch_markedit_fniii;

//Flattabs
  flat_motion_cb_Fniis = launch_flat_motion_cb_fniis;

//Dropbutton
  flat_dropshow_cb_Fni = launch_dropshow_cb_fni;

//Dial
  button_press_cb_Fnd = launch_button_press_cb_fnd;
  button_release_cb_Fnd = launch_button_release_cb_fnd;
  mousemove_cb_Fnd = launch_mousemove_cb_fnd;

//Colorbrowser
  change_cb_FnVVV = launch_change_cb_fnvvv;
  drag_cb_FnVVV = launch_drag_cb_fnvvv;
}

int param_action(Ihandle* dialog, int param_index, void* user_data) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_POINTER)) param_cb_FniV) (eif_access (obj), dialog, param_index, user_data);
}

int get_param_dialog (const char* title, void* user_data, const char* format, int param_count, int param_extra, void** param_data) {
  return IupGetParamv(title, param_action, user_data, format, param_count, param_extra, param_data);
}

// One function for each type of event

// Common callbacks
int callback_idle_action(void) {
  return ((int (*) (EIF_REFERENCE)) idle_action_Fidle) (eif_access (obj));
}

void callback_help_cb(Ihandle *ih) {
  ((void(*) (EIF_REFERENCE, EIF_POINTER)) help_cb_Fn) (eif_access (obj), ih);
}

int callback_map_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) map_cb_Fn) (eif_access (obj), ih);
}

int callback_unmap_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) unmap_cb_Fn) (eif_access (obj), ih);
}

int callback_destroy_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) destroy_cb_Fn) (eif_access (obj), ih);
}

int callback_ldestroy_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) ldestroy_cb_Fn) (eif_access (obj), ih);
}

int callback_getfocus_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) getfocus_cb_Fn) (eif_access (obj), ih);
}

int callback_killfocus_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) killfocus_cb_Fn) (eif_access (obj), ih);
}

int callback_enterwindow_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) enterwindow_cb_Fn) (eif_access (obj), ih);
}

int callback_leavewindow_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) leavewindow_cb_Fn) (eif_access (obj), ih);
}

int callback_k_any(Ihandle *ih, int c) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) k_any_Fni) (eif_access (obj), ih, c);
}

// Action callbacks
int callback_action_Fn(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) action_Fn) (eif_access (obj), ih);
}

// Dialog and progress dialog callback
int callback_close_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) close_cb_Fn) (eif_access (obj), ih);
}

int callback_copydata_cb(Ihandle *ih, char* cmdLine, int size) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32)) copydata_cb_Fnsi) (eif_access (obj), ih, cmdLine, size);
}

int callback_dropfiles_cb(Ihandle *ih, char* filename, int num, int x, int y) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32)) dropfiles_cb_Fnsiii) (eif_access (obj), ih, filename, num, x, y);
}

int callback_mdiactivate_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) mdiactivate_cb_Fn) (eif_access (obj), ih);
}

int callback_move_cb(Ihandle *ih, int x, int y) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) move_cb_Fnii) (eif_access (obj), ih, x, y);
}

int callback_resize_cb(Ihandle *ih, int width, int height) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) resize_cb_Fnii) (eif_access (obj), ih, width, height);
}

int callback_show_cb(Ihandle *ih, int state) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) show_cb_Fni) (eif_access (obj), ih, state);
}

int callback_trayclick_cb(Ihandle *ih, int but, int pressed, int dclick) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32)) trayclick_cb_Fniii) (eif_access (obj), ih, but, pressed, dclick);
}

// File dialog callback
int callback_file_cb(Ihandle *ih, char* file_name, char* status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_POINTER)) file_cb_Fnss) (eif_access (obj), ih, file_name, status);
}

// Color dialog callback
int callback_colorupdate_cb (Ihandle* ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) colorupdate_cb_Fn) (eif_access (obj), ih);
}

// Progress dialog callback
int callback_cancel_cb (Ihandle* ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) cancel_cb_Fn) (eif_access (obj), ih);
}
/*
// Get param dialog callback
int callback_getparam(Ihandle* dialog, int param_index, void* user_data) {
  return getparam_FniV(iup_object(0), dialog, param_index, user_data);  
}
*/

// Tabs callbacks

int callback_tabchange_cb(Ihandle *ih, Ihandle* new_tab, Ihandle* old_tab) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_POINTER)) tabchange_cb_Fnnn) (eif_access (obj), ih, new_tab, old_tab);
}

int callback_tabchangepos_cb(Ihandle *ih, int new_pos, int old_pos) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) tabchangepos_cb_Fnii) (eif_access (obj), ih, new_pos, old_pos);
}

int callback_tabclose_cb(Ihandle *ih, int pos) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) tabclose_cb_Fni) (eif_access (obj), ih, pos);
}

int callback_rightclick_cb(Ihandle *ih, int pos) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) rightclick_cb_Fni) (eif_access (obj), ih, pos);
}

// Detach box callback
int callback_detached_cb(Ihandle *ih, Ihandle *new_parent, int x, int y) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) detached_cb_Fnnii) (eif_access (obj), ih, new_parent, x, y);
}

int callback_restored_cb(Ihandle *ih, Ihandle *old_parent, int x, int y) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) restored_cb_Fnnii) (eif_access (obj), ih, old_parent, x, y);
}

// Expander callbacks
int callback_openclose_cb(Ihandle *ih, int state) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) openclose_cb_Fni) (eif_access (obj), ih, state);
}

int callback_extrabutton_cb(Ihandle *ih, Ihandle *new_parent, int button, int pressed) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) extrabutton_cb_Fnii) (eif_access (obj), ih, new_parent, button, pressed);
}

// Val callback
int callback_valuechanged_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) valuechanged_cb_Fn) (eif_access (obj), ih); // Also matrix
}

// Button callback
int callback_button_cb(Ihandle *ih, int button, int pressed, int x, int y, char* status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) button_cb_Fniiiis) (eif_access (obj), ih, button, pressed, x, y, status);
}

// Canvas callbacks
int callback_action_Fnff(Ihandle *ih, float posx, float posy) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_REAL_32, EIF_REAL_32)) action_Fnff) (eif_access (obj), ih, posx, posy);
}
// Also Dialog
int callback_focus_cb(Ihandle *ih, int focus) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) focus_cb_Fni) (eif_access (obj), ih, focus);
}

int callback_motion_cb(Ihandle *ih, int x, int y, char *status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) motion_cb_Fniis) (eif_access (obj), ih, x, y, status);
}

int callback_keypress_cb(Ihandle *ih, int c, int press) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) keypress_cb_Fnii) (eif_access (obj), ih, c, press);
}

int callback_scroll_cb(Ihandle *ih, int op, float posx, float posy) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_REAL_32, EIF_REAL_32)) scroll_cb_Fniff) (eif_access (obj), ih, op, posx, posy);
}

int callback_wheel_cb(Ihandle *ih, float delta, int x, int y, char *status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_REAL_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) wheel_cb_Fndiis) (eif_access (obj), ih, delta, x, y, status);
}

int callback_click_cb(Ihandle *ih, char *url) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER)) click_cb_Fns) (eif_access (obj), ih, url);
}

// List callbacks
int callback_action_Fnsii(Ihandle *ih, char *text, int item, int state) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) action_Fnsii) (eif_access (obj), ih, text, item, state);
}

int callback_caret_cb(Ihandle *ih, int lin, int col, int pos) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32)) caret_cb_Fniii) (eif_access (obj), ih, lin, col, pos);
}

int callback_dblclick_cb(Ihandle *ih, int item, char *text) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_POINTER)) dblclick_cb_Fnis) (eif_access (obj), ih, item, text);
}

int callback_dragdrop_cb(Ihandle *ih, int drag_id, int drop_id, int isshift, int iscontrol) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32)) dragdrop_cb_Fniiii) (eif_access (obj), ih, drag_id, drop_id, isshift, iscontrol);
}

int callback_dropdown_cb(Ihandle *ih, int state) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) dropdown_cb_Fni) (eif_access (obj), ih, state);
}

int callback_edit_cb(Ihandle *ih, int c, char *new_value) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_POINTER)) edit_cb_Fnis) (eif_access (obj), ih, c, new_value);
}

int callback_multiselect_cb(Ihandle *ih, char *value) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER)) multiselect_cb_Fns) (eif_access (obj), ih, value);
}

// Spin callback
int callback_spin_cb(Ihandle *ih, int inc) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) spin_cb_Fni) (eif_access (obj), ih, inc);
}

// Text callback
int callback_action_Fnis(Ihandle *ih, int c, char *new_value) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_POINTER)) action_Fnis) (eif_access (obj), ih, c, new_value);
}

// Toggle callback
int callback_action_Fni(Ihandle* ih, int state) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) action_Fni) (eif_access (obj), ih, state);
}

// Tree callbacks
int callback_selection_cb (Ihandle *ih, int id, int status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) selection_cb_Fnii) (eif_access (obj), ih, id, status);
}

int callback_multiselection_cb (Ihandle *ih, int* ids, int n) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32)) multiselection_cb_Fnpi) (eif_access (obj), ih, ids, n);
}

int callback_multiunselection_cb (Ihandle *ih, int* ids, int n) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32)) multiunselection_cb_Fnpi) (eif_access (obj), ih, ids, n);
}

int callback_branchopen_cb (Ihandle *ih, int id) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) branchopen_cb_Fni) (eif_access (obj), ih, id);
}

int callback_branchclose_cb (Ihandle *ih, int id) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) branchclose_cb_Fni) (eif_access (obj), ih, id);
}

int callback_executeleaf_cb (Ihandle *ih, int id) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) executeleaf_cb_Fni) (eif_access (obj), ih, id);
}

int callback_showrename_cb (Ihandle *ih, int id) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) showrename_cb_Fni) (eif_access (obj), ih, id);
}

int callback_rename_cb (Ihandle *ih, int id, char *title) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_POINTER)) rename_cb_Fnis) (eif_access (obj), ih, id, title);
}

int callback_noderemoved_cb (Ihandle *ih, void* userdata) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER)) noderemoved_cb_Fns) (eif_access (obj), ih, userdata);
}

int callback_togglevalue_cb_Fnii (Ihandle *ih, int id, int state) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) togglevalue_cb_Fnii) (eif_access (obj), ih, id, state);
}

// Menu callbacks
int callback_highlight_cb (Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) highlight_cb_Fn) (eif_access (obj), ih);
}

int callback_open_cb (Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) open_cb_Fn) (eif_access (obj), ih);
}

int callback_menuclose_cb (Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) menuclose_cb_Fn) (eif_access (obj), ih);
}

// Drag&Drop callbacks
int callback_dragbegin_cb (Ihandle* ih, int x, int y) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) dragbegin_cb_Fnii) (eif_access (obj), ih, x, y);
}

int callback_dragdatasize_cb (Ihandle* ih, char* type) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER)) dragdatasize_cb_Fns) (eif_access (obj), ih, type);
}

int callback_dragdata_cb (Ihandle* ih, char* type, void* data, int size) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32)) dragdata_cb_FnsVi) (eif_access (obj), ih, type, data, size);
}

int callback_dragend_cb (Ihandle* ih, int action) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) dragend_cb_Fni) (eif_access (obj), ih, action);
}

int callback_dropdata_cb (Ihandle* ih, char* type, void* data, int size, int x, int y) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32)) dropdata_cb_FnsViii) (eif_access (obj), ih, type, data, size, x, y);
}

int callback_dropmotion_cb (Ihandle *ih, int x, int y, char *status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) dropmotion_cb_Fniis) (eif_access (obj), ih, x, y, status);
}

// Menu recent files
int callback_recent_cb (Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) recent_cb_Fn) (eif_access (obj), ih);
}

void config_recent_init (Ihandle* ih, Ihandle* menu, int max_recent) {
  IupConfigRecentInit(ih, menu, (Icallback) callback_recent_cb, max_recent);
}

// Flat button
int callback_flat_action_Fn(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) flat_action_Fn) (eif_access (obj), ih);
}

int callback_flat_button_cb(Ihandle *ih, int button, int pressed, int x, int y, char* status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) flat_button_cb_Fniiiis) (eif_access (obj), ih, button, pressed, x, y, status);
}

int callback_flat_focus_cb(Ihandle *ih, int focus) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) flat_focus_cb_Fni) (eif_access (obj), ih, focus);
}

int callback_flat_enterwindow_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) flat_enterwindow_cb_Fn) (eif_access (obj), ih);
}

int callback_flat_leavewindow_cb(Ihandle *ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) flat_leavewindow_cb_Fn) (eif_access (obj), ih);
}

// Cells
int callback_draw_cb(Ihandle* ih, int line, int column, int xmin, int xmax, int ymin, int ymax, cdCanvas* canvas) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) draw_cb_Fniiiiiic) (eif_access (obj), ih, line, column, xmin, xmax, ymin, ymax, canvas);
}

int callback_height_cb(Ihandle* ih, int line) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) height_cb_Fni) (eif_access (obj), ih, line);
}

int callback_hspan_cb(Ihandle* ih, int line, int column) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) hspan_cb_Fnii) (eif_access (obj), ih, line, column);
}

int callback_mouseclick_cb(Ihandle* ih, int button, int pressed, int line, int column, int x, int y, char* status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) mouseclick_cb_Fniiiiiis) (eif_access (obj), ih, button, pressed, line, column, x, y, status);
}

int callback_mousemotion_cb(Ihandle *ih, int line, int column, int x, int y, char *r) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) mousemotion_cb_Fniiiis) (eif_access (obj), ih, line, column, x, y, r);
}

int callback_ncols_cb(Ihandle* ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) ncols_cb_Fn) (eif_access (obj), ih);
}

int callback_nlines_cb(Ihandle* ih) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER)) nlines_cb_Fn) (eif_access (obj), ih);
}

int callback_scrolling_cb(Ihandle* ih, int line, int column) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) scrolling_cb_Fnii) (eif_access (obj), ih, line, column);
}

int callback_vspan_cb(Ihandle* ih, int line, int column) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) vspan_cb_Fnii) (eif_access (obj), ih, line, column);
}

int callback_width_cb(Ihandle* ih, int column) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) width_cb_Fni) (eif_access (obj), ih, column);
}

// Color bar

char* callback_cell_cb(Ihandle* ih, int cell) {

  unsigned char r, g, b;
  long int cl;
  static char str[30];

  cl = ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) cell_cb_Fni) (eif_access (obj), ih, cell);

  if (cl == -1)
    {
      return NULL;
    }
  else
    {
      cdDecodeColor(cl, &r, &g, &b);
      sprintf(str, "%d %d %d", (int)r, (int)g, (int)b);

      return str;
    }
}

int callback_extended_cb(Ihandle* ih, int cell) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) extended_cb_Fni) (eif_access (obj), ih, cell);
}

int callback_select_cb(Ihandle* ih, int cell, int type) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) select_cb_Fnii) (eif_access (obj), ih, cell, type);
}

int callback_switch_cb(Ihandle* ih, int prim_cell, int sec_cell) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) switch_cb_Fnii) (eif_access (obj), ih, prim_cell, sec_cell);
}

// Matrix
int callback_action_Fniiiis(Ihandle *ih, int key, int lin, int col, int edition, char* value) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) action_Fniiiis) (eif_access (obj), ih, key, lin, col, edition, value);
}

int callback_click_cb_Fniis (Ihandle *ih, int lin, int col, char *status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) click_cb_Fniis) (eif_access (obj), ih, lin, col, status);
}

int callback_colresize_cb (Ihandle *ih, int col) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) colresize_cb_Fni) (eif_access (obj), ih, col);
}

int callback_release_cb (Ihandle *ih, int lin, int col, char *status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) release_cb_Fniis) (eif_access (obj), ih, lin, col, status);
}

int callback_resizematrix_cb (Ihandle *ih, int width, int height) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) resizematrix_cb_Fnii) (eif_access (obj), ih, width, height);
}

int callback_mousemove_cb (Ihandle *ih, int lin, int col) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) mousemove_cb_Fnii) (eif_access (obj), ih, lin, col);
}

int callback_enteritem_cb (Ihandle *ih, int lin, int col) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) enteritem_cb_Fnii) (eif_access (obj), ih, lin, col);
}

int callback_leaveitem_cb (Ihandle *ih, int lin, int col) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) leaveitem_cb_Fnii) (eif_access (obj), ih, lin, col);
}

int callback_scrolltop_cb (Ihandle *ih, int lin, int col) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) scrolltop_cb_Fnii) (eif_access (obj), ih, lin, col);
}

int callback_bgcolor_cb (Ihandle *ih, int lin, int col, int *red, int *green, int *blue) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER, EIF_POINTER, EIF_POINTER)) bgcolor_cb_FniiVVV) (eif_access (obj), ih, lin, col, red, green, blue);
}

int callback_fgcolor_cb (Ihandle *ih, int lin, int col, int *red, int *green, int *blue) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER, EIF_POINTER, EIF_POINTER)) fgcolor_cb_FniiVVV) (eif_access (obj), ih, lin, col, red, green, blue);
}

char* callback_font_cb (Ihandle* ih, int lin, int col) {
  return ((char* (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) font_cb_Fnii) (eif_access (obj), ih, lin, col);
}

char* callback_type_cb (Ihandle* ih, int lin, int col) {
  return ((char* (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) type_cb_Fnii) (eif_access (obj), ih, lin, col);
}

int callback_dropcheck_cb (Ihandle *ih, int lin, int col) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) dropcheck_cb_Fnii) (eif_access (obj), ih, lin, col);
}

char* callback_translatevalue_cb (Ihandle* ih, int lin, int col, char* value) {
  return ((char* (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) translatevalue_cb_Fniis) (eif_access (obj), ih, lin, col, value);
}

int callback_togglevalue_cb_Fniii (Ihandle *ih, int lin, int col, int status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32)) togglevalue_cb_Fniii) (eif_access (obj), ih, lin, col, status);
}

int callback_drop_cb (Ihandle *ih, Ihandle *drop, int lin, int col) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) drop_cb_Fnnii) (eif_access (obj), ih, drop, lin, col);
}

int callback_menudrop_cb (Ihandle *ih, Ihandle *drop, int lin, int col) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) menudrop_cb_Fnnii) (eif_access (obj), ih, drop, lin, col);
}

int callback_dropselect_cb (Ihandle *ih, int lin, int col, Ihandle *drop, char *t, int i, int v) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) dropselect_cb_Fniinsii) (eif_access (obj), ih, lin, col, drop, t, i, v);
}

int callback_edition_cb (Ihandle *ih, int lin, int col, int mode, int update) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32)) edition_cb_Fniiii) (eif_access (obj), ih, lin, col, mode, update);
}

char* callback_value_cb (Ihandle* ih, int lin, int col) {
  return ((char* (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) value_cb_Fnii) (eif_access (obj), ih, lin, col);
}

int callback_value_edit_cb (Ihandle *ih, int lin, int col, char* newval) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) value_edit_cb_Fniis) (eif_access (obj), ih, lin, col, newval);
}

int callback_mark_cb (Ihandle* ih, int lin, int col) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32)) mark_cb_Fnii) (eif_access (obj), ih, lin, col);
}

int callback_markedit_cb (Ihandle *ih, int lin, int col, int marked) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32)) markedit_cb_Fniii) (eif_access (obj), ih, lin, col, marked);
}

// Flat tabs

int callback_flat_motion_cb(Ihandle *ih, int x, int y, char *status) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_POINTER)) flat_motion_cb_Fniis) (eif_access (obj), ih, x, y, status);
}

// Drop button

int callback_flat_dropshow_cb (Ihandle *ih, int state) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32)) flat_dropshow_cb_Fni) (eif_access (obj), ih, state);
}

// Dial

int callback_button_press_cb (Ihandle *ih, double angle) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_REAL_32)) button_press_cb_Fnd) (eif_access (obj), ih, angle);
}

int callback_button_release_cb (Ihandle *ih, double angle) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_REAL_32)) button_release_cb_Fnd) (eif_access (obj), ih, angle);
}

int callback_mousemove_cb_Fnd (Ihandle *ih, double angle) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_REAL_32)) mousemove_cb_Fnd) (eif_access (obj), ih, angle);
}

// Color browse

int callback_change_cb (Ihandle *ih, unsigned char r, unsigned char g, unsigned char b) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32)) change_cb_FnVVV) (eif_access (obj), ih, r, g, b);
}

int callback_drag_cb (Ihandle *ih, unsigned char r, unsigned char g, unsigned char b) {
  return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, EIF_INTEGER_32, EIF_INTEGER_32)) drag_cb_FnVVV) (eif_access (obj), ih, r, g, b);
}

// Set callbacks

void connect_function (const char *name, int operation) {
  
  if (strcmp("IDLE_ACTION",name) == 0)
    {
      if (operation == 1)
	{
	  IupSetFunction(name, (Icallback) callback_idle_action);
	}
      else
	{
	  IupSetFunction(name, NULL);
	}
    }
  else
    {
      printf("Unknown function.");
    }
}

void connect_callback (Ihandle* ih, const char *name, const char *type, int operation) {

  if (operation == 0)
    {
      IupSetCallback(ih, name, NULL);
      return;
    }

  if (strcmp("HELP_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_help_cb);
    }
  else if (strcmp("MAP_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_map_cb);
    }
  else if (strcmp("UNMAP_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_unmap_cb);
    }
  else if (strcmp("DESTROY_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_destroy_cb);
    }
  else if (strcmp("LDESTROY_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_ldestroy_cb);
    }
  else if (strcmp("GETFOCUS_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_getfocus_cb);
    }
  else if (strcmp("KILLFOCUS_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_killfocus_cb);
    }
  else if (strcmp("ENTERWINDOW_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_enterwindow_cb);
    }
  else if (strcmp("LEAVEWINDOW_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_leavewindow_cb);
    }
  else if (strcmp("K_ANY",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_k_any);
    }
  else if (strcmp("ACTION",name) == 0)
    {
      if (strcmp("Fn", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_action_Fn);
	}
      else if (strcmp("Fnff", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_action_Fnff);
	}
      else if (strcmp("Fns", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_click_cb);
	}
      else if (strcmp("Fnsii", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_action_Fnsii);
	}
      else if (strcmp("Fnis", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_action_Fnis);
	}
      else if (strcmp("Fni", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_action_Fni);
	}
    }
  else if (strcmp("CLOSE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_close_cb);
    }
  else if (strcmp("COPYDATA_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_copydata_cb);
    }
  else if (strcmp("DROPFILES_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dropfiles_cb);
    }
  // Skeep CUSTOMFRAME_CB
  else if (strcmp("MDIACTIVATE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_mdiactivate_cb);
    }
  else if (strcmp("MOVE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_move_cb);
    }
  else if (strcmp("RESIZE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_resize_cb);
    }
  else if (strcmp("SHOW_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_show_cb);
    }
  else if (strcmp("TRAYCLICK_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_trayclick_cb);
    }
  else if (strcmp("FILE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_file_cb);
    }
  else if (strcmp("COLORUPDATE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_colorupdate_cb);
    }
  else if (strcmp("CANCEL_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_cancel_cb);
    }
  else if (strcmp("GETPARAM",name) == 0)
    {
    }
  else if (strcmp("TABCHANGE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_tabchange_cb);
    }
  else if (strcmp("TABCHANGEPOS_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_tabchangepos_cb);
    }
  else if (strcmp("TABCLOSE_CB",name) == 0)
    {
       IupSetCallback(ih, name, (Icallback) callback_tabclose_cb);
    }
  else if (strcmp("RIGHTCLICK_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_rightclick_cb);
    }
  else if (strcmp("DETACHED_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_detached_cb);
    }
  else if (strcmp("RESTORED_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_restored_cb);
    }
  else if (strcmp("OPENCLOSE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_openclose_cb);
    }
  else if (strcmp("EXTRABUTTON_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_extrabutton_cb);
    }
  else if (strcmp("VALUECHANGED_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_valuechanged_cb);
    }
  else if (strcmp("BUTTON_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_button_cb);
    }
  else if (strcmp("FOCUS_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_focus_cb);
    }
  else if (strcmp("MOTION_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_motion_cb);
    }
  else if (strcmp("KEYPRESS_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_keypress_cb);
    }
  else if (strcmp("SCROLL_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_scroll_cb);
    }
  // TOUCH_CB and MULTITOUCH_CB
  else if (strcmp("WHEEL_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_wheel_cb);
    }
  // WOM_CB
  else if (strcmp("CARET_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_caret_cb);
    }
  else if (strcmp("DBLCLICK_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dblclick_cb);
    }
  else if (strcmp("DRAGDROP_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dragdrop_cb);
    }
  else if (strcmp("DROPDOWN_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dropdown_cb);
    }
  else if (strcmp("EDIT_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_edit_cb);
    }
  else if (strcmp("MULTISELECT_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_multiselect_cb);
    }
  else if (strcmp("SPIN_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_spin_cb);
    }
  else if (strcmp("SELECTION_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_selection_cb);
    }
  else if (strcmp("MULTISELECTION_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_multiselection_cb);
    }
  else if (strcmp("MULTIUNSELECTION_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_multiunselection_cb);
    }
  else if (strcmp("BRANCHOPEN_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_branchopen_cb);
    }
  else if (strcmp("BRANCHCLOSE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_branchclose_cb);
    }
  else if (strcmp("EXECUTELEAF_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_executeleaf_cb);
    }
  else if (strcmp("SHOWRENAME_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_showrename_cb);
    }
  else if (strcmp("RENAME_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_rename_cb);
    }
  else if (strcmp("NODEREMOVED_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_noderemoved_cb);
    }
  else if (strcmp("TOGGLEVALUE_CB",name) == 0)
    {
      if (strcmp("Fnii", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_togglevalue_cb_Fnii);
	}
      // Matrix
      else if (strcmp("Fniii", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_togglevalue_cb_Fniii);
	}
    }
  else if (strcmp("HIGHLIGHT_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_highlight_cb);
    }
  else if (strcmp("OPEN_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_open_cb);
    }
  else if (strcmp("MENUCLOSE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_menuclose_cb);
    }
  else if (strcmp("DRAGBEGIN_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dragbegin_cb);
    }
  else if (strcmp("DRAGDATASIZE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dragdatasize_cb);
    }
  else if (strcmp("DRAGDATA_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dragdata_cb);
    }
  else if (strcmp("DRAGEND_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dragend_cb);
    }
  else if (strcmp("DROPDATA_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dropdata_cb);
    }
  else if (strcmp("DROPMOTION_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dropmotion_cb);
    }
  else if (strcmp("FLAT_ACTION",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_flat_action_Fn);
    }
  else if (strcmp("FLAT_BUTTON_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_flat_button_cb);
    }
  else if (strcmp("FLAT_FOCUS_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_flat_focus_cb);
    }
  else if (strcmp("FLAT_ENTERWINDOW_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_flat_enterwindow_cb);
    }
  else if (strcmp("FLAT_LEAVEWINDOW_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_flat_leavewindow_cb);
    }
  // Cells
  else if (strcmp("DRAW_CB",name) == 0) // Also Matrix
    {
      IupSetCallback(ih, name, (Icallback) callback_draw_cb);
    }
  else if (strcmp("HEIGHT_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_height_cb);
    }
  else if (strcmp("HSPAN_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_hspan_cb);
    }
  else if (strcmp("MOUSECLICK_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_mouseclick_cb);
    }
  else if (strcmp("MOUSEMOTION_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_mousemotion_cb);
    }
  else if (strcmp("NCOLS_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_ncols_cb);
    }
  else if (strcmp("NLINES_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_nlines_cb);
    }
  else if (strcmp("SCROLLING_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_scrolling_cb);
    }
  else if (strcmp("VSPAN_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_vspan_cb);
    }
  else if (strcmp("WIDTH_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_width_cb);
    }
  else if (strcmp("CELL_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_cell_cb);
    }
  else if (strcmp("EXTENDED_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_extended_cb);
    }
  else if (strcmp("SELECT_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_select_cb);
    }
  else if (strcmp("SWITCH_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_switch_cb);
    }
  // Matrix (Interaction)
  else if (strcmp("ACTION_CB", name) == 0)
    {
      if (strcmp("Fniiiis", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_action_Fniiiis);
	}
      else if (strcmp("Fn", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_action_Fn);
	}
    }
  else if (strcmp("CLICK_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_click_cb_Fniis);
    }
  else if (strcmp("COLRESIZE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_colresize_cb);
    }
  else if (strcmp("RELEASE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_release_cb);
    }
  else if (strcmp("RESIZEMATRIX_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_resizematrix_cb);
    }
  else if (strcmp("MOUSEMOVE_CB",name) == 0)
    {
      if (strcmp("Fnd", type) == 0)
	{
	  IupSetCallback(ih, name, (Icallback) callback_mousemove_cb_Fnd);
	}
      else
	{
	  IupSetCallback(ih, name, (Icallback) callback_mousemove_cb);
	}
    }
  else if (strcmp("ENTERITEM_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_enteritem_cb);
    }
  else if (strcmp("LEAVEITEM_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_leaveitem_cb);
    }
  else if (strcmp("SCROLLTOP_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_scrolltop_cb);
    }
  else if (strcmp("BGCOLOR_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_bgcolor_cb);
    }
  else if (strcmp("FGCOLOR_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_fgcolor_cb);
    }
  else if (strcmp("FONT_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_font_cb);
    }
  else if (strcmp("TYPE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_type_cb);
    }
  else if (strcmp("DROPCHECK_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dropcheck_cb);
    }
  else if (strcmp("TRANSLATEVALUE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_translatevalue_cb);
    }
  else if (strcmp("DROP_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_drop_cb);
    }
  else if (strcmp("MENUDROP_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_menudrop_cb);
    }
  else if (strcmp("DROPSELECT_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_dropselect_cb);
    }
  else if (strcmp("EDITION_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_edition_cb);
    }
  else if (strcmp("VALUE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_value_cb);
    }
  else if (strcmp("VALUE_EDIT_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_value_edit_cb);
    }
  else if (strcmp("MARK_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_mark_cb);
    }
  else if (strcmp("MARKEDIT_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_markedit_cb);
    }
  // Flat tabs
  else if (strcmp("FLAT_MOTION_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_flat_motion_cb);
    }
  // Drop button
  else if (strcmp("DROPSHOW_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_flat_dropshow_cb);
    }
  // Dial
  else if (strcmp("BUTTON_PRESS_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_button_press_cb);
    }
  else if (strcmp("BUTTON_RELEASE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_button_release_cb);
    }
  // Color browse
  else if (strcmp("CHANGE_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_change_cb);
    }
  else if (strcmp("DRAG_CB",name) == 0)
    {
      IupSetCallback(ih, name, (Icallback) callback_drag_cb);
    }
  else
    {
      printf("Unknown function.");
    }
}
